package huzh.foundation.dao;

import java.util.ArrayList;

/**
 *<p>title:IDAO</p>
 *<p>description:</p>
 * @since 2014-6-8
 * @author huzh
 * @version 1.0
 */
public interface IDAO extends IBaseDAO{
    /**
     * @param taskName
     * @param param
     * @return
     */
    public abstract DAOResult select(String taskName, ArrayList<?> param);

    /**
     * @param taskName
     * @param param
     * @param pageParaList
     * @return
     */
    public abstract DAOResult select(String taskName, ArrayList<?> param, ArrayList<?> pageParaList);

    /**
     * @param taskName
     * @param param
     * @return
     */
    public abstract DAOResult insert(String taskName, ArrayList<?> param);

    /**
     * @param taskName
     * @param param
     * @return
     */
    public abstract DAOResult update(String taskName, ArrayList<?> param);

    /**
     * @param taskName
     * @param param
     * @return
     */
    public abstract DAOResult delete(String taskName, ArrayList<?> param);

    /**
     * @param taskName
     * @param sqlClause
     * @return
     */
    public abstract DAOResult executeSelectSqlClause(String taskName, String sqlClause);

    /**
     * @param taskName
     * @param sqlClause
     * @param page_record
     * @param curpage
     * @return
     */
    public abstract DAOResult executeSelectSqlClause(String taskName, String sqlClause, int page_record, int curpage);

    /**
     * @param taskName
     * @param sqlClause
     * @return
     */
    public abstract DAOResult executeUpdateSqlClause(String taskName, String sqlClause);

    /**
     * @param databaseName
     * @param taskName
     * @param param
     * @return
     */
    public abstract DAOResult selectByDatabase(String databaseName, String taskName, ArrayList<?> param);

    /**
     * @param databaseName
     * @param taskName
     * @param param
     * @param pageParaList
     * @return
     */
    public abstract DAOResult selectByDatabase(String databaseName, String taskName, ArrayList<?> param,
            ArrayList<?> pageParaList);

    /**
     * @param databaseName
     * @param taskName
     * @param param
     * @return
     */
    public abstract DAOResult insertByDatabase(String databaseName, String taskName, ArrayList<?> param);

    /**
     * @param databaseName
     * @param taskName
     * @param param
     * @return
     */
    public abstract DAOResult updateByDatabase(String databaseName, String taskName, ArrayList<?> param);

    /**
     * @param databaseName
     * @param taskName
     * @param param
     * @return
     */
    public abstract DAOResult deleteByDatabase(String databaseName, String taskName, ArrayList<?> param);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @return
     */
    public abstract DAOResult executeSelectSqlClauseByDatabase(String databaseName, String taskName, String sqlClause);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @param paramList
     * @return
     */
    public abstract DAOResult executeSelectSqlClauseByDatabase(String databaseName, String taskName, String sqlClause,
            ArrayList<?> paramList);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @param paramList
     * @param timeout
     * @return
     */
    public abstract DAOResult executeSelectSqlClauseByDatabase(String databaseName, String taskName, String sqlClause, 
            ArrayList<?> paramList, int timeout);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @param page_record
     * @param curpage
     * @return
     */
    public abstract DAOResult executeSelectSqlClauseByDatabase(String databaseName, String taskName, String sqlClause, 
            int page_record, int curpage);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @return
     */
    public abstract DAOResult executeUpdateSqlClauseByDatabase(String databaseName, String taskName, String sqlClause);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @param paramList
     * @return
     */
    public abstract DAOResult executeUpdateSqlClauseByDatabase(String databaseName, String taskName, String sqlClause, 
            ArrayList<?> paramList);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @param paramList
     * @param timeout
     * @return
     */
    public abstract DAOResult executeUpdateSqlClauseByDatabase(String databaseName, String taskName, String sqlClause,
            ArrayList<?> paramList, int timeout);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @param page_record
     * @param curpage
     * @param rowcount
     * @return
     */
    public abstract DAOResult executeSelectSqlClauseByDatabase(String databaseName, String taskName, String sqlClause, 
            int page_record, int curpage, int rowcount);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @param page_record
     * @param curpage
     * @param rowcount
     * @param otherSumFieldClause
     * @return
     */
    public abstract DAOResult executeSelectSqlClauseByDatabase(String databaseName, String taskName, String sqlClause, 
            int page_record, int curpage, int rowcount, String otherSumFieldClause);

    /**
     * @param databaseName
     * @param taskName
     * @param sqlClause
     * @param page_record
     * @param curpage
     * @param rowcount
     * @param otherSumFieldClause
     * @param paramList
     * @param timeout
     * @return
     */
    public abstract DAOResult executeSelectSqlClauseByDatabase(String databaseName, String taskName, String sqlClause,
            int page_record, int curpage, int rowcount, String otherSumFieldClause, ArrayList<?> paramList, int timeout);

    /**
     * @param taskName
     * @return
     */
    public abstract TaskDomain getTaskDomain(String taskName);

    /**
     * @return
     */
    public abstract DAOParamGenerator getDAOParamGenerator();

    /**
     * @return
     */
    public abstract DAOTransactionExecutor getDAOTransactionExecutor();

    /**
     * @param databaseName
     * @throws Exception
     */
    public abstract void beginTransaction(String databaseName) throws Exception;

    /**
     * @param databaseName
     * @param timeout
     * @throws Exception
     */
    public abstract void beginTransaction(String databaseName, int timeout) throws Exception;

    /**
     * @param databaseName
     * @param commit
     * @throws Exception
     */
    public abstract void endTransaction(String databaseName, boolean commit) throws Exception;

    /**
     * @param taskList
     * @return
     */
    public abstract DAOResult[] executeParallelDAOTask(ParallelDAOTask[] taskList);

    /**
     * @param threadPoolName
     * @param taskList
     * @return
     */
    public abstract DAOResult[] executeParallelDAOTask(String threadPoolName, ParallelDAOTask[] taskList);
}
